<?php
if(defined("_PARA_ACCOUNT"))
    return;
define("_PARA_ACCOUNT", 1);

class Account {
    public $uid;
    public $screen_name;
    public $pwd_md5;
    public $email;
    public $state;
    public $group_name;
    public $msg_count;
    public $karma;
    public $comment;
    public $changedate;
    public $createdate;
    public $act_code;

    public $is_guest = false;
    public $debug = '';


    public function Account( 
        $uid, $screen_name, $pwd_md5, $email, $state,
        $group_name, $msg_count, $karma, $comment, $changedate, $createdate,
        $act_code

        ) {
        $this->uid         = $uid;
        $this->screen_name = $screen_name;
        $this->pwd_md5     = $pwd_md5;
        $this->email       = $email;
        $this->state       = $state;
        $this->group_name  = $group_name;
        $this->msg_count   = $msg_count;
        $this->karma       = $karma;
        $this->comment     = $comment;
        $this->changedate  = $changedate;
        $this->createdate  = $createdate;
        $this->act_code    = $act_code;
    }


    public function check_authentication( $screenname, $pwd_md5 ) {
        if($screenname != $this->screen_name)
            return false;
        if( $pwd_md5 != $this->pwd_md5)
            return false;
        return true;
    }


    public function is_admin() {
        if($this->group_name == 'admin')
            return true;
        return false;
    }


    public function is_logged_in() {
        return !$this->is_guest;
    }

}

?>